package com.lcifn.middleware.rpc.transport.future;

import java.util.HashMap;
import java.util.Map;

/**
 * 在途请求
 * @author lichao
 * @date 2021/2/2 18:15
 */
public class InFlightRequest {

    private Map<Integer, ResponseFuture> inFlightRequestMap = new HashMap<>();

    public void add(ResponseFuture future) {
        inFlightRequestMap.put(future.getRequestId(), future);
    }

    public ResponseFuture remove(Integer requestId) {
        ResponseFuture future = inFlightRequestMap.remove(requestId);
        return future;
    }
}
